package com.hxzy.yygh.hosp.controller;

import com.hxzy.yygh.common.result.Result;
import com.hxzy.yygh.hosp.service.HospitalService;
import com.hxzy.yygh.model.hosp.Hospital;
import com.hxzy.yygh.vo.hosp.HospitalQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;



@Api(tags = "医院管理模块")
@RestController
@RequestMapping("/admin/hosp/hospital")
public class HospitalController {
    @Autowired
    private HospitalService hospitalService;

    //医院信息，分页展示
    @ApiOperation(value = "分页展示医院信息")
    @GetMapping("selectByPage/{page}/{limit}")
    public Result selectByPage(@PathVariable Integer page, @PathVariable Integer limit, HospitalQueryVo hospitalQueryVo){
        Page<Hospital> pageModel = hospitalService.selectHospByPage(page,limit,hospitalQueryVo);
        return Result.ok(pageModel);
    }

    //更改医院状态
    @ApiOperation(value = "更改医院状态接口")
    @PutMapping("updateStatus/{id}/{status}")
    public Result updateStatus(@PathVariable String id, @PathVariable Integer status){
        hospitalService.updateStatus(id, status);
        return Result.ok();
    }

    //医院详情信息
    @ApiOperation(value = "医院详情信息")
    @GetMapping("showDetails/{id}")
    public Result showDetails(@PathVariable String id){
        Hospital hospital = hospitalService.showDetails(id);
        return Result.ok(hospital);
    }
}
